<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改学生信息</title>
</head>

<body>
<?php
include'conn.php';
$sql = "SELECT * FROM students WHERE id = ".$_GET['id'];
// echo $sql;
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_assoc($result);
var_dump($row);
?>
<form name="form3" method="post" action="insert.php">
      <table width="432" border="1">
        <tr>
          <th height="40" colspan="2" scope="row">修改学生信息</th>
        </tr>
        <tr>
          <th width="140" height="40" scope="row">用户名</th>
          <td width="280" height="40">
          <input name="uname" type="text" disabled="disabled" id="uname" value="<?php echo $row['uname']?>" size="40"></td>
        </tr>
        <tr>
          <th height="40" scope="row">姓名</th>
          <td height="40">
          <input name="realname" type="text" id="realname" size="40" value="<?php echo $row['realname']?>"></td>
        </tr>
        <tr>
          <th height="40" scope="row">学号</th>
          <td height="40">
          <input name="unumber" type="text" id="unumber" size="40"value="<?php echo $row['unumber']?>"></td>
        </tr>
        <tr>
          <th height="40" scope="row">性别</th>
          <td height="40"><p>
            <label>
              <input name="gender" type="radio" id="gender1" value="1" <?php if($row['gender'] == 1){echo "checked='checked'";}?>>
              男</label>
            <br>
            <label>
              <input type="radio" name="gender" value="0" id="gender2" <?php if($row['gender'] == 0){echo "checked='checked'";}?>>
              女</label>
            <br>
            <br>
          </p></td>
        </tr>
        <tr>
          <th height="40" scope="row">班级</th>
          <td height="40">
            <select name="class" id="class">
              <option value="1" <?php if($row['class'] == 1){echo "selected";}?>>网络21-1</option>
              <option value="2" <?php if($row['class'] == 2){echo "selected";}?>>网络21-2</option>
              <option value="3" <?php if($row['class'] == 3){echo "selected";}?>>网络21-3</option>
              <option value="4" <?php if($row['class'] == 4){echo "selected";}?>>网络21-4</option>
              <option value="5" <?php if($row['class'] == 5){echo "selected";}?>>网络21-5</option>
          </select></td>
        </tr>
        <tr>
          <th height="40" scope="row">兴趣爱好</th>
          <td height="40"><p>
            <label>
              <input type="checkbox" name="hobby[]" value="1" id="CheckboxGroup2_0" <?php if(strpos($row['hobby'],"篮球") !== false){echo "checked='checked'";}?>/>
              篮球 <?php var_dump(strpos($row['hobby'],"篮球"))?></label>
            <br>
            <label>
              <input type="checkbox" name="hobby[]" value="2" id="CheckboxGroup2_1" <?php if(strpos($row['hobby'],"足球") !== false){echo "checked='checked'";}?>>
              足球 <?php var_dump(strpos($row['hobby'],"足球"))?></label>
            <br>
            <label>
              <input type="checkbox" name="hobby[]" value="3" id="CheckboxGroup2_2" <?php if(strpos($row['hobby'],"游泳") !== false){echo "checked='checked'";}?>>
              游泳 <?php var_dump(strpos($row['hobby'],"游泳"))?></label>
            <br>
          </p></td>
        </tr>
        <tr>
          <th height="93" scope="row">备注</th>
          <th height="93" scope="row">
          <textarea name="mark" rows="5" id="wenben"><?php echo $row['mark']?></textarea></th>
        </tr>
        <tr>
          <th height="40" colspan="2" scope="row"><input type="submit" name="zhuce" id="zhuce" value="更新"></th>
        </tr>
      </table>
    </form>
</body>
</html>